//
//  BaseViewController.swift
//  微博三天
//
//  Created by jessica on 15/11/16.
//  Copyright © 2015年 jessica. All rights reserved.
//

import UIKit

class BaseViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
    
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
                //如果子控制器组的数量不为0
        if self.childViewControllers.count != 0{
        
        viewController.navigationItem.backBarButtonItem = UIBarButtonItem(title: "返回", style: .Plain, target: self, action: "back")
            

                         //藏起来 底部 栏      推送
            viewController.hidesBottomBarWhenPushed = true

        }
        //count == 0
        super.pushViewController(viewController, animated: animated)
        
    }
    

    @objc private func back(){
    
    navigationController?.popViewControllerAnimated(true)
    
    }
    
}
